layui.use(['jquery', 'layer', 'miniAdmin', 'tfApi'], function () {
    var $ = layui.jquery,
        layer = layui.layer,
        miniAdmin = layui.miniAdmin,
        API = layui.tfApi,
        storage = localStorage,//window.sessionStorage,
        menuSta = localStorage.getItem("menuSta");

        console.log('menuStavv=',menuSta);

    if(menuSta == "seller") {//  商户
        menuUrl = "api/initMerchant.json";
        $("#userName_A").html(storage.getItem("sellerName"));
    }else if(menuSta == 'server'){ // 服务商
        menuUrl = "api/initService.json";
        $("#userName_A").html(storage.getItem("serviceName"));
    }else{
        window.location = 'page/login.html';
    }


    var options = {
        iniUrl: menuUrl,    // 初始化接口 initService.json 服务商菜单
        clearUrl: "api/clear.json", // 缓存清理接口
        urlHashLocation: true,      // 是否打开hash定位
        bgColorDefault: false,      // 主题默认配置
        multiModule: true,          // 是否开启多模块
        menuChildOpen: false,       // 是否默认展开菜单
        loadingTime: 0,             // 初始化加载时间
        pageAnim: true,             // iframe窗口动画
        maxTabNum: 20,              // 最大的tab打开数量
    };

    miniAdmin.render(options);


    $('.login-out').on("click", function () {
        layer.msg('退出登录成功', {icon:1,time:1500}, function () {
            window.location = 'page/login.html';
            var storage = localStorage;//window.sessionStorage;;
            storage.removeItem("sellerId");
            storage.removeItem("sellerName");
            storage.removeItem("serviceId")
            storage.removeItem("serviceName");
            $.post(API.CURL+'/user/logOut',function (r) {
                console.log(r);
            });
        });
    });
});